import axios from "axios";
//封装数据请求
var beseUrl = "http://192.168.2.26:81/api/"
//使用本地地址 发布时需要修改
function ajax_get(url, params = {}) {
	return new Promise(resolve => {
		axios.get(url, {
			params
		}).then(r => {
			resolve(r)
		})
	})

}
// 获取首页数据
const indexinit = data => ajax_get(beseUrl + "init", data);
// 分类数据  商品列表
const goodsindex = data => ajax_get(beseUrl + "goods/index", data);
// 商品分类列表
const goodscategory = data => ajax_get(beseUrl + "goods/category/index", data);
// 商品详情
const goodshow = data => ajax_get(beseUrl + "goods/show/1", data);
// 用户注册
const memberRegister = data => ajax_get(beseUrl + "member/register", data);
// 注册
const memberLogin = data => ajax_get(beseUrl + "member/login", data);
// 获取图形验证码
const memberCaptcha = data => ajax_get(beseUrl + "member/captcha", data);
// 导出数据
export {
	indexinit,
	goodsindex,
	goodscategory,
	goodshow,
	memberRegister,
	memberLogin,
	memberCaptcha
}
